#include "animalshowwidget.h"
#include "ui_animalshowwidget.h"

AnimalShowWidget::AnimalShowWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::AnimalShowWidget)
{
    ui->setupUi(this);
    const QList<QSharedPointer<Animal>>& animals = AnimalManager::Instance().getAnimals();
    init(animals);
}

void AnimalShowWidget::init(const QList<QSharedPointer<Animal> > &animals)
{
    for(auto animalPtr:animals){
        AnimalWidget* animalWidget = new AnimalWidget(this,animalPtr);
        ui->verticalLayout->addWidget(animalWidget);
    }
}

AnimalShowWidget::~AnimalShowWidget()
{
    delete ui;
}

